from time import time

def getTime(filename):
    start = time()
    file = open(filename)
    isSwapped = True
    a = []
    for i in file.readlines():
        a.append(int(i))
    j = len(a)
    while isSwapped:
        isSwapped = False
        for i in range(0, j - 1):
            if a[i] > a[i + 1]:
                a[i], a[i + 1] = a[i + 1], a[i]
                isSwapped = True
    end = time()
    file.close()
    return end - start

for i in ['m1_sorted.txt','m2_reverse.txt','m3_shuffle.txt']:
    print(i, int(getTime(i)))








